home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ipack.exe / FTPS.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-04-12  |  11.5 KB  |  344 lines

  1. VERSION 2.00
  2. Begin MDIForm MainForm 
  3.    Caption         =   "Mabry FTP Sample Program"
  4.    ClientHeight    =   8040
  5.    ClientLeft      =   3795
  6.    ClientTop       =   1485
  7.    ClientWidth     =   7365
  8.    Height          =   8445
  9.    Left            =   3735
  10.    LinkTopic       =   "MDIForm1"
  11.    Top             =   1140
  12.    Width           =   7485
  13.    Begin PictureBox Picture2 
  14.       Align           =   2  'Align Bottom
  15.       BackColor       =   &H00C0C0C0&
  16.       Height          =   405
  17.       Left            =   0
  18.       ScaleHeight     =   375
  19.       ScaleWidth      =   7335
  20.       TabIndex        =   6
  21.       Top             =   7635
  22.       Width           =   7365
  23.       Begin Label Label7 
  24.          BackColor       =   &H00C0C0C0&
  25.          FontBold        =   0   'False
  26.          FontItalic      =   0   'False
  27.          FontName        =   "MS Sans Serif"
  28.          FontSize        =   8.25
  29.          FontStrikethru  =   0   'False
  30.          FontUnderline   =   0   'False
  31.          Height          =   225
  32.          Left            =   6210
  33.          TabIndex        =   14
  34.          Top             =   105
  35.          Width           =   840
  36.       End
  37.       Begin Label Label1 
  38.          Alignment       =   1  'Right Justify
  39.          BackColor       =   &H00C0C0C0&
  40.          Caption         =   "Progress:"
  41.          FontBold        =   0   'False
  42.          FontItalic      =   0   'False
  43.          FontName        =   "MS Sans Serif"
  44.          FontSize        =   8.25
  45.          FontStrikethru  =   0   'False
  46.          FontUnderline   =   0   'False
  47.          Height          =   225
  48.          Left            =   5040
  49.          TabIndex        =   13
  50.          Top             =   105
  51.          Width           =   1050
  52.       End
  53.       Begin Label lblLastAction 
  54.          BackColor       =   &H00C0C0C0&
  55.          Caption         =   "Label2"
  56.          FontBold        =   0   'False
  57.          FontItalic      =   0   'False
  58.          FontName        =   "MS Sans Serif"
  59.          FontSize        =   8.25
  60.          FontStrikethru  =   0   'False
  61.          FontUnderline   =   0   'False
  62.          Height          =   255
  63.          Left            =   1065
  64.          TabIndex        =   12
  65.          Top             =   105
  66.          Width           =   375
  67.       End
  68.       Begin Label lblLastError 
  69.          BackColor       =   &H00C0C0C0&
  70.          Caption         =   "Label2"
  71.          FontBold        =   0   'False
  72.          FontItalic      =   0   'False
  73.          FontName        =   "MS Sans Serif"
  74.          FontSize        =   8.25
  75.          FontStrikethru  =   0   'False
  76.          FontUnderline   =   0   'False
  77.          Height          =   255
  78.          Left            =   3585
  79.          TabIndex        =   11
  80.          Top             =   105
  81.          Width           =   975
  82.       End
  83.       Begin Label lblState 
  84.          BackColor       =   &H00C0C0C0&
  85.          Caption         =   "Label2"
  86.          FontBold        =   0   'False
  87.          FontItalic      =   0   'False
  88.          FontName        =   "MS Sans Serif"
  89.          FontSize        =   8.25
  90.          FontStrikethru  =   0   'False
  91.          FontUnderline   =   0   'False
  92.          Height          =   255
  93.          Left            =   2145
  94.          TabIndex        =   10
  95.          Top             =   105
  96.          Width           =   615
  97.       End
  98.       Begin Label Label3 
  99.          Alignment       =   1  'Right Justify
  100.          BackColor       =   &H00C0C0C0&
  101.          Caption         =   "Last Action:"
  102.          FontBold        =   0   'False
  103.          FontItalic      =   0   'False
  104.          FontName        =   "MS Sans Serif"
  105.          FontSize        =   8.25
  106.          FontStrikethru  =   0   'False
  107.          FontUnderline   =   0   'False
  108.          Height          =   255
  109.          Left            =   105
  110.          TabIndex        =   9
  111.          Top             =   105
  112.          Width           =   855
  113.       End
  114.       Begin Label Label4 
  115.          Alignment       =   1  'Right Justify
  116.          BackColor       =   &H00C0C0C0&
  117.          Caption         =   "Last Error:"
  118.          FontBold        =   0   'False
  119.          FontItalic      =   0   'False
  120.          FontName        =   "MS Sans Serif"
  121.          FontSize        =   8.25
  122.          FontStrikethru  =   0   'False
  123.          FontUnderline   =   0   'False
  124.          Height          =   255
  125.          Left            =   2625
  126.          TabIndex        =   8
  127.          Top             =   105
  128.          Width           =   855
  129.       End
  130.       Begin Label Label5 
  131.          Alignment       =   1  'Right Justify
  132.          BackColor       =   &H00C0C0C0&
  133.          Caption         =   "State:"
  134.          FontBold        =   0   'False
  135.          FontItalic      =   0   'False
  136.          FontName        =   "MS Sans Serif"
  137.          FontSize        =   8.25
  138.          FontStrikethru  =   0   'False
  139.          FontUnderline   =   0   'False
  140.          Height          =   255
  141.          Left            =   1425
  142.          TabIndex        =   7
  143.          Top             =   105
  144.          Width           =   615
  145.       End
  146.    End
  147.    Begin PictureBox Picture1 
  148.       Align           =   1  'Align Top
  149.       BackColor       =   &H00C0C0C0&
  150.       BorderStyle     =   0  'None
  151.       Height          =   3975
  152.       Left            =   0
  153.       ScaleHeight     =   3975
  154.       ScaleWidth      =   7365
  155.       TabIndex        =   0
  156.       Top             =   0
  157.       Width           =   7365
  158.       Begin mFTP FTP1 
  159.          Account         =   ""
  160.          AllocBytes      =   0
  161.          Blocking        =   0   'False
  162.          Debug           =   1  'Enabled
  163.          Directory       =   ""
  164.          Host            =   ""
  165.          Left            =   4320
  166.          Pattern         =   ""
  167.          Port            =   21
  168.          Timeout         =   60
  169.          Top             =   3450
  170.          Type            =   1  'Binary
  171.       End
  172.       Begin Timer Timer1 
  173.          Interval        =   100
  174.          Left            =   5085
  175.          Top             =   3495
  176.       End
  177.       Begin CommandButton cmdFileTransfers 
  178.          Caption         =   "File Transfers"
  179.          FontBold        =   0   'False
  180.          FontItalic      =   0   'False
  181.          FontName        =   "MS Sans Serif"
  182.          FontSize        =   8.25
  183.          FontStrikethru  =   0   'False
  184.          FontUnderline   =   0   'False
  185.          Height          =   480
  186.          Left            =   2685
  187.          TabIndex        =   5
  188.          Top             =   3480
  189.          Width           =   1275
  190.       End
  191.       Begin CommandButton cmdConnection 
  192.          Caption         =   "Connection"
  193.          FontBold        =   0   'False
  194.          FontItalic      =   0   'False
  195.          FontName        =   "MS Sans Serif"
  196.          FontSize        =   8.25
  197.          FontStrikethru  =   0   'False
  198.          FontUnderline   =   0   'False
  199.          Height          =   480
  200.          Left            =   135
  201.          TabIndex        =   4
  202.          Top             =   3480
  203.          Width           =   1275
  204.       End
  205.       Begin CommandButton cmdDirectory 
  206.          Caption         =   "Directory"
  207.          FontBold        =   0   'False
  208.          FontItalic      =   0   'False
  209.          FontName        =   "MS Sans Serif"
  210.          FontSize        =   8.25
  211.          FontStrikethru  =   0   'False
  212.          FontUnderline   =   0   'False
  213.          Height          =   480
  214.          Left            =   1410
  215.          TabIndex        =   3
  216.          Top             =   3480
  217.          Width           =   1275
  218.       End
  219.       Begin ListBox listDir 
  220.          FontBold        =   0   'False
  221.          FontItalic      =   0   'False
  222.          FontName        =   "Courier New"
  223.          FontSize        =   8.25
  224.          FontStrikethru  =   0   'False
  225.          FontUnderline   =   0   'False
  226.          Height          =   1080
  227.          Left            =   150
  228.          TabIndex        =   2
  229.          Top             =   1830
  230.          Width           =   7005
  231.       End
  232.       Begin ListBox listTrace 
  233.          FontBold        =   0   'False
  234.          FontItalic      =   0   'False
  235.          FontName        =   "Courier New"
  236.          FontSize        =   8.25
  237.          FontStrikethru  =   0   'False
  238.          FontUnderline   =   0   'False
  239.          Height          =   1080
  240.          Left            =   165
  241.          TabIndex        =   1
  242.          Top             =   255
  243.          Width           =   6990
  244.       End
  245.    End
  246. Option Explicit
  247. Dim frmLoaded As Form
  248. Dim cmdCurrent As CommandButton
  249. Dim fIgnoreListDirClick As Integer
  250. Private Sub cmdConnection_Click ()
  251.     LoadForm frmConnection, cmdConnection
  252. End Sub
  253. Private Sub cmdDirectory_Click ()
  254.     LoadForm frmDirectory, cmdDirectory
  255. End Sub
  256. Private Sub cmdFileTransfers_Click ()
  257.     LoadForm frmFileTransfers, cmdFileTransfers
  258. End Sub
  259. Sub FTP1_AsyncError (ErrorCode As Integer, ErrorMsg As String)
  260.     Trace MainForm.listTrace, "Async Error:" & Str(ErrorCode) & " " & ErrorMsg
  261. End Sub
  262. Sub FTP1_Connected (fConnected As Integer)
  263.     Debug.Print "connected " & fConnected
  264. End Sub
  265. Private Sub Ftp1_Debug (DebugMsg As String)
  266.     If (Ftp1.Action <> FtpActionGetDirList And Ftp1.Action <> FtpActionGetFilenameList) Then
  267.         Trace MainForm.listTrace, DebugMsg
  268.     End If
  269. End Sub
  270. Private Sub Ftp1_DirItem (Item As String)
  271.     fIgnoreListDirClick = True
  272.     Trace MainForm.listDir, Item
  273.     fIgnoreListDirClick = False
  274. End Sub
  275. Private Sub Ftp1_Done ()
  276.     Trace MainForm.listTrace, "done event fired"
  277.     If (Ftp1.Action = FtpActionQuote) Then
  278.         Trace MainForm.listTrace, CStr(Ftp1.ReadData)
  279.     End If
  280. End Sub
  281. Sub FTP1_Progress (Bytes As Long)
  282.     Label7.Caption = Bytes
  283. End Sub
  284. Private Sub listDir_Click ()
  285.     Dim s As String
  286.     Dim i As Integer
  287.        
  288.     If (fIgnoreListDirClick = True Or ListDir.ListIndex < 0) Then
  289.         Exit Sub
  290.     End If
  291.     s = ListDir.List(ListDir.ListIndex)
  292.     i = Len(s)
  293.     Do While (i > 1)
  294.         If (Mid(s, i, 1) = " ") Then
  295.             Debug.Print Mid(s, i + 1)
  296.             SetSelectedServerFile Mid(s, i + 1)
  297.             If (Left(s, 1) = "d" Or Left(s, 1) = "l") Then
  298.                 If (frmLoaded Is frmDirectory) Then
  299.                     frmDirectory.txtDirectory.Text = GetSelectedServerFile()
  300.                 ElseIf (frmLoaded Is frmFileTransfers) Then
  301.                     frmFileTransfers.txtGetSrcFilename.Text = ""
  302.                 End If
  303.             Else
  304.                 If (frmLoaded Is frmDirectory) Then
  305.                     frmDirectory.txtDirectory.Text = ""
  306.                 ElseIf (frmLoaded Is frmFileTransfers) Then
  307.                     frmFileTransfers.txtGetSrcFilename.Text = GetSelectedServerFile()
  308.                 End If
  309.             End If
  310.             Exit Sub
  311.         End If
  312.         i = i - 1
  313.     Loop
  314. End Sub
  315. Sub LoadForm (frmNew As Form, cmdNew As CommandButton)
  316.     If (frmNew Is frmLoaded) Then
  317.         Exit Sub
  318.     End If
  319.     Load frmNew
  320.     frmNew.Show
  321.     If (Not frmLoaded Is Nothing) Then
  322.         Unload frmLoaded
  323.         cmdCurrent.FontBold = False
  324.     End If
  325.     cmdNew.FontBold = True
  326.     Set frmLoaded = frmNew
  327.     Set cmdCurrent = cmdNew
  328. End Sub
  329. Private Sub MDIForm_Load ()
  330.     ListTrace.Height = 1500
  331.     ListDir.Height = 1500
  332.     DoEvents
  333.     LoadForm frmConnection, cmdConnection
  334. End Sub
  335. Private Sub MDIForm_Resize ()
  336.     ListTrace.Width = Me.ScaleWidth - (2 * ListTrace.Left)
  337.     ListDir.Width = ListTrace.Width
  338. End Sub
  339. Private Sub Timer1_Timer ()
  340.     lblLastAction.Caption = Ftp1.Action
  341.     lblLastError.Caption = Ftp1.LastError
  342.     lblState.Caption = Ftp1.State
  343. End Sub
  344.